

import request from "@/utils/request"

export default {
    reqTrademark({ current, pagesize }) {
        return request.get(`/admin/product/baseTrademark/${current}/${pagesize}`)
    },
    reqDelete(id) {
        return request.delete(`/admin/product/baseTrademark/remove/${id}`)
    },
    saveTrademark(formData) {
        return request[formData.id ? "put" : "post"](`/admin/product/baseTrademark/${formData.id ? 'update' : 'save'}`, formData)
    },
    // 获取用户列表
    reqUserList(currnet, pagesize, username) {
        return request.get(`/admin/acl/user/${currnet}/${pagesize}?username=${username}`)
    },
    addUser(userData) {
        return request[userData.id ? 'put' : 'post'](`/admin/acl/user/${userData.id ? 'update' : "save"}`, userData)
    },
    // 删除数据
    deleteUser(id) {
        return request.delete(`/admin/acl/user/remove/${id}`)
    },
    reqAssignList(id) {
        return request.get(`/admin/acl/user/toAssign/${id}`)
    },
    // 修改角色权限
    setAssigin(userId, roleId) {
        return request.post(`admin/acl/user/doAssign?userId=${userId}&roleId=${roleId}`)
    },
    // 获取角色列表
    reqRoleList(current, pageSize, roleName) {
        return request.get(`/admin/acl/role/${current}/${pageSize}?roleName=${roleName}`)
    },
    reqAddRole(roleName) {
        return request.post('/admin/acl/role/save', { roleName })
    },
    // 删除角色
    deleteRole(id){
        return request.delete(`/admin/acl/role/remove/${id}`)
    },
    // 获取树形数据
    reqTreeList(id){
        return request.get(`/admin/acl/permission/toAssign/${id}`)
    },
    saveTree(id,permissionId){
        return request.post(`/admin/acl/permission/doAssign?roleId=${id}&permissionId=${permissionId}`)
    },
    reqSaveRoleName(role){
        return request.put("/admin/acl/role/update",role)
    }
}
